package de.cbf.cam.dsa.item.act;

import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

import de.cbf.cam.dsa.item.ControllerEditItem;
import de.cbf.cam.dsa.item.ControllerEditItems;

/**
 * The activator class controls the plug-in life cycle
 */
public class ActivatorItem extends AbstractUIPlugin {

	// The plug-in ID
	public static final String PLUGIN_ID = "de.cbf.cam.dsa.item"; //$NON-NLS-1$

	// The shared instance
	private static ActivatorItem plugin;


	protected ControllerEditItem 	controllerEditItem;
	protected ControllerEditItems 	controllerEditItems;


	/**
	 * The constructor
	 */
	public ActivatorItem() {
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
		super.start(context);
		plugin = this;
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
		plugin = null;
		super.stop(context);
	}

	/**
	 * Returns the shared instance
	 *
	 * @return the shared instance
	 */
	public static ActivatorItem getDefault() {
		return plugin;
	}

	/**
	 * @return the controllerEditItem
	 */
	public ControllerEditItem getControllerEditItem() {
		if(controllerEditItem == null){
			controllerEditItem = new ControllerEditItem();
		}
		return controllerEditItem;
	}

	/**
	 * @param controllerEditItem the controllerEditItem to set
	 */
	public void setControllerItemEditor(ControllerEditItem controllerItemEditor) {
		this.controllerEditItem = controllerItemEditor;
	}

	public ControllerEditItems getControllerEditItems() {
		if(controllerEditItems == null){
			controllerEditItems = new ControllerEditItems();
		}
		return controllerEditItems;
	}

	public void setControllerEditItems(ControllerEditItems controllerEditItems) {
		this.controllerEditItems = controllerEditItems;
	}
}
